package com.seraph.splitviewdemo;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.View.OnLongClickListener;
import android.view.WindowManager;
import android.view.animation.ScaleAnimation;
import android.widget.LinearLayout;
import android.widget.TextView;

public class SplitViewDemo extends Activity  implements OnClickListener, OnLongClickListener {
    /** Called when the activity is first created. */
	
	private View v1,v2,v3,v4;
	private LinearLayout l1, l2;
	private ScaleAnimation disappear, reappear, zoomIn, zoomOut;
	
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        v1 = (View)findViewById(R.id.view1);
        v1.setOnClickListener(this);
        v1.setOnLongClickListener(this);
        
        v2 = (View)findViewById(R.id.view2);
        v2.setOnClickListener(this);
        v2.setOnLongClickListener(this);
        
        v3 = (View)findViewById(R.id.view3);
        v3.setOnClickListener(this);
        v3.setOnLongClickListener(this);
        
        v4 = (View)findViewById(R.id.view4);
        v4.setOnClickListener(this);
        v4.setOnLongClickListener(this);
        
        l1 = (LinearLayout)findViewById(R.id.linearLayout1);
        l2 = (LinearLayout)findViewById(R.id.linearLayout2);
        
        float one = (float)1.;
        float zero = (float)0.;
        float four = (float)4.;
        
        disappear = new ScaleAnimation(one, zero, one, zero);
        reappear = new ScaleAnimation(zero, one, zero, one);
        zoomIn = new ScaleAnimation(one, four, one, four);
        zoomOut = new ScaleAnimation(four, one, four, one);
        
    }

	@Override
	public void onClick(View v) {
		// TODO Auto-generated method stub
		switch (v.getId()) {
			case R.id.view1:
				//v1.startAnimation(zoomIn);
				l2.setVisibility(View.GONE);
				v2.setVisibility(View.GONE);
				break;
			case R.id.view2:
				l2.setVisibility(View.GONE);
				v1.setVisibility(View.GONE);
				break;
			case R.id.view3:
				l1.setVisibility(View.GONE);
				v4.setVisibility(View.GONE);
				break;
			case R.id.view4:
				l1.setVisibility(View.GONE);
				v3.setVisibility(View.GONE);
		}
			
		
	}

	@Override
	public boolean onLongClick(View v) {
		// TODO Auto-generated method stub
		v2.setVisibility(View.VISIBLE);
		v3.setVisibility(View.VISIBLE);
		v4.setVisibility(View.VISIBLE);
		v1.setVisibility(View.VISIBLE);
		l1.setVisibility(View.VISIBLE);
		l2.setVisibility(View.VISIBLE);
		return true;
	}
}